import React, { PropTypes } from 'react'
// import _ from 'lodash'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
 //import VideoItem from '../../../common/video-item.jsx'
 //import ImageItem, { EmImgProcessType } from '../../../common/image-item.jsx'
// import MediaSlider from '../../../common/media-slider.jsx'
// import MapLocation from '../../../common/map-location.jsx'
// import FileInput from '../../../common/file_input.jsx'
import NextPage from './next.jsx'

import { actions } from '../modules/login'

@connect(
  state => ({datas: state.layoutState, params: state.params}),
  dispatch => ({actions: bindActionCreators({...actions}, dispatch)})
)
class Login extends React.Component {
  componentDidMount() {
    console.log('componentDidMount.......')
  }

  onUpload(files) {
    console.log(files)

    //let formData = new FormData();
    //formData.append('file', {uri: uri, type: 'application/octet-stream', name: key});
    //formData.append('key', key);
    //formData.append('token', token);
    //
    //let options = {};
    //options.body = formData;
    //options.method = 'post';

    //fetch('', options).then(res)
  }

  render() {
    const { actions, datas } = this.props
    const { fetching, err, data } = datas
    const { fetchLogin, loginInit } = actions
    //let data = [
    //  {
    //    imageUrl:'http://img2.jsbn.com/venus/vda/20161224/14825507343876028_1920x680.jpg',
    //    linkUrl:'cq.jsbn.com',
    //  },
    //  {
    //    imageUrl:'http://img2.jsbn.com/venus/vda/20161122/14797950401621928_1919x680.jpg',
    //    linkUrl:'cq.jsbn.com',
    //  }
    //]
    //let stores = [
    //  {
    //    storeId: 1,
    //    longitude: 106.51871,
    //    latitude: 29.598242,
    //    address: '芭菲盛宴北城国际店',
    //  },
    //  {
    //    storeId: 2,
    //    longitude: 106.516658,
    //    latitude: 29.534856,
    //    address: '芭菲盛宴奥体店',
    //  },
    //  {
    //    storeId: 3,
    //    longitude: 106.58193,
    //    latitude: 29.562108,
    //    address: '芭菲盛宴解放碑店',
    //  },
    //  {
    //    storeId: 4,
    //    longitude: 106.533175,
    //    latitude: 29.532343,
    //    address: '芭菲嘉宴九滨店',
    //  },
    //  {
    //    storeId: 5,
    //    longitude: 106.467571,
    //    latitude: 29.51627,
    //    address: '芭菲嘉宴二郎店',
    //  },
    //]
    return (
      <div>
        {
          //<VideoItem
          //  coverImgUrl='http://img2.jsbn.com/venus/canmeramanHosterPro/20160321/1458535211448078720150929170217934776_1200x800.jpg'
          //  videoUrl='http://img.ksbbs.com/asset/Mon_1605/0ec8cc80112a2d6.mp4'
          //  width={600}
          //  height={400}
          //  aspectRatio='3:2'
          //  autoPlay={false}
          ///>
        }
        {
          //<ImageItem
          //  imageUrl='http://img2.jsbn.com/venus/canmeramanHosterPro/20160321/1458535211448078720150929170217934776_1200x800.jpg'
          //  linkUrl='http://www.baidu.com'
          //  width={600}
          //  aspectRatio='3:2'
          //  quality={80}
          //  processType={EmImgProcessType.emGD_HW_L}
          //  water={false}
          ///>
        }
        {
          //<MediaSlider
          //  aspectRatio='3:2'
          //  quality={90}
          //  height={800}
          //  data={data}
          ///>
          //<MapLocation
          //  stores={stores}
          //  storeId={1}
          //  height={800}
          //  width={600}
          ///>
          //<FileInput onUpload={(files) => this.onUpload(files)} />
        }
        <div>
          <button className='btn btn-default' onClick={fetchLogin}>
            {
              fetching ? '登录中' : '登录'
            }
          </button>
          <a href="#/nav">跳转</a>
        </div>
        <div>
        </div>
        <div>
          {
            err ? <NextPage name={'我在这里'} goBack={loginInit} /> : null
          }
        </div>
      </div>
    )
  }
}

export default Login
